import os

def copy(sourcepath,targetpath):
    sourcefile=os.open(sourcepath,os.O_RDONLY)
    targetfile=os.open(targetpath,os.O_WRONLY|os.O_CREAT)
    while True:
        binary=os.read(sourcefile,512)
        if len(binary) == 0:
            return
        os.write(targetfile,binary)
copy('test.txt','text.bak')

basename=os.path.basename('D:/pythonProject/test.py')
path=os.path.dirname('D:/pythonProject/test.py')
print(os.sep,basename,path)
filepath=path+os.sep+basename
print(filepath)
print(os.path.join(path,basename))
print(os.path.exists('test.py'))

print(os.path.getsize('test.py'))
print(os.path.isfile('test.py'))
print(os.path.isdir('test.py'))

def listDir(d):
    entries=os.listdir(d)
    for entry in entries:
        path=os.path.join(d,entry)
        print(path)
        if os.path.isdir(path):
            listDir(path)
listDir('.')

print(os.path.abspath('test.py'))
print(os.path.relpath(path))
print(os.path.normpath(path))

print(os.path.getatime('test.py'))
print(os.path.getmtime('test.py'))
print(os.path.getctime('test.py'))
